<?php
	//
	//This php will handle the 
	// UserFetch.java 
	// - fetchUserById function
	//
	
	//Connect to database
	include '../../dbc.php';
	
	$meal = $_POST['meal_id'];
	$user = $_POST['user_id'];
	
	//Select non-blocked restaurant comment
    $query01 = "SELECT * FROM meal_like WHERE meal='$meal' AND user='$user'";
	$query01_result = mysql_query($query01);
	$number = mysql_num_rows($query01_result);
	
	if($number > 0){
		//Already liked, not response
	}else{
		//Add new like
		$create_date = date("Y-m-d H:i:s");
		$query02 = "INSERT INTO meal_like (user,meal,like_time) VALUES ('$user','$meal','$create_date')";
		mysql_query($query02);
	}
	
	$response["STATUS"] = "1";
	echo json_encode($response);

?>